using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KVB.Common;
using System.Data.SqlClient;

namespace Customer_Profile.Admin
{
    public class OperateDao
    {
        public OperateDao()
        {
        }
        internal DataSet GetOperationList()
        {
            SqlConnection conn = null;
            try
            {
                DB.Connection(ref conn);
                string sql = "select * from dbo.TP_TOperate order by operateTime desc";
                return DB.ExecuteDataset(conn, CommandType.Text, sql);
            }
            catch (Exception ex)
            {
                Log.WriteDefaultLog("GetOperationList", ex.ToString());
                return null;
            }
            finally
            {
                DB.ConnDispose(ref conn);
            }
        }
        internal void AddOperation(string operators,string content)
        {
            SqlConnection conn = null;
            try
            {
                SqlParameter[] parameters ={ new SqlParameter("@operators",SqlDbType.NVarChar,100),
                                             new SqlParameter("@content",SqlDbType.NVarChar,500)};
                parameters[0].Value = operators;
                parameters[1].Value = content;
                DB.Connection(ref conn);
                DB.ExecuteNonQuery(conn, CommandType.StoredProcedure, "Proc_OperationAdd", parameters);
            }
            catch (Exception ex)
            {
                Log.WriteDefaultLog("AddOperation", ex.ToString());
            }
            finally
            {
                DB.ConnDispose(ref conn);
            }
        }
    }
}
